package teach.aistar.mapper;


import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import teach.aistar.model.entity.User;

import java.util.List;

public interface UserMapper {
    @Select("select * from user")
    List<User> findAll();
    @Select("select * from user where u_id = #{uId}")
    User getById(Integer id);

    @Select("select * from user where uname=#{value}")
    User getByUsername(String uname);

//    insert into orders(orders_no, total, price, create_date, user_id)
//    values (#{ordersNo},#{total},#{price},#{createDate},#{userId})

    int add(User user);



    @Update("update user set uname = #{uname},pwd = #{pwd} where u_id = #{uId}")
    int update(@Param("uname") String uname, @Param("pwd") String pwd,@Param("uId") Integer uId);

}
